package com.qboot.generate.consts;

import com.qboot.common.entity.BaseEntity;
import com.qboot.generate.vo.JavaToMysqlTypeVo;

import java.util.Arrays;
import java.util.List;

/**
 * 代码生成模块-常量
 *
 * @author Tellsea
 * @date 2022/11/25
 */
public class GenerateConst {
    /**
     * 实体类基类字段-用于排除list中的列
     */
    public static final List<String> BASE_ENTITY_LIST = Arrays.asList(
            BaseEntity.Fields.createBy, BaseEntity.Fields.createTime,
            BaseEntity.Fields.updateBy, BaseEntity.Fields.updateTime);
    /**
     * 默认排除CRUD字段
     */
    public static final List<String> QUERY_EXCLUDE_LIST = Arrays.asList(
            BaseEntity.Fields.createBy, BaseEntity.Fields.createTime,
            BaseEntity.Fields.updateBy, BaseEntity.Fields.updateTime,
            BaseEntity.deleteStatus, "sort");
    /**
     * java类型与mysql类型转换映射关系
     */
    public static final List<JavaToMysqlTypeVo> JAVA_TYPE_TO_MYSQL_TYPE = Arrays.asList(
            new JavaToMysqlTypeVo("", "String", Arrays.asList("varchar", "char", "text", "tinytext", "longtext", "mediumtext", "set")),
            new JavaToMysqlTypeVo("", "Integer", Arrays.asList("tinyint", "smallint", "int", "mediumint")),
            new JavaToMysqlTypeVo("", "Long", Arrays.asList("bigint")),
            new JavaToMysqlTypeVo("", "Float", Arrays.asList("float")),
            new JavaToMysqlTypeVo("", "Double", Arrays.asList("double")),
            new JavaToMysqlTypeVo("", "Boolean", Arrays.asList("bit")),
            new JavaToMysqlTypeVo("", "Byte[]", Arrays.asList("blob", "tinyblob", "longblob", "mediumiblob")),
            new JavaToMysqlTypeVo("java.math.BigDecimal", "BigDecimal", Arrays.asList("decimal")),
            new JavaToMysqlTypeVo("java.util.Date", "Date", Arrays.asList("datetime", "timestamp", "year", "time")));
}
